home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update25.zoo / util / diffs
Encoding:
Text File  |  1992-10-10  |  22.4 KB  |  887 lines

  1. *** 1.32    1992/08/14 17:24:38
  2. --- Changelog    1992/10/11 02:44:26
  3. ***************
  4. *** 342,344 ****
  5. --- 342,379 ----
  6.       put out file symbols ala aln. julians nm should do better now.
  7.   
  8.   ----------------------------- Patchlevel 31 --------------------------------
  9. + sym-ld.c:: michal
  10. +     was`nt compiling anymore.
  11. + ld.c, sym-ld.c:: michal
  12. +     When searching through a library a function symdef_library was
  13. +     repeatedly allocating and freeing (at the same address)
  14. +     subentry->strings and subentry (line 2962) and later it was executing
  15. +         free (subentry->strings);
  16. +                 subentry->strings = 0;
  17. +     My NeXT was patient enough to survive such treatment for a few
  18. +     iterations but after a while it was dropping a core from malloc().
  19. +     Exactly the same applies to sym-ld. I do not know why this problem
  20. + ld.c :: howard
  21. +     Incorporate baserel patches.
  22. + toglclr.c:: Frank Ridderbusch
  23. +     rewrote toglclr for all flags: usage
  24. +         toglclr [options] file file ...
  25. +     options: -fload = toggle `fast load'
  26. +              -frun  = toggle `load program into fast ram'
  27. +                  -fram  = toggle `malloc from fast ram'
  28. + toglclr.c:: ++jrb
  29. +     clean it up for cross-environment, add support for
  30. +         WORD_ALIGNED
  31. + Makefile.cross, Makefile.st:: ++jrb
  32. +     add target for toglclr
  33. + cnm.c:: ++jrb
  34. +     cleanup for hpux
  35. + ----------------------------- Patchlevel 32 --------------------------------
  36. *** 1.13    1992/06/03 18:40:27
  37. --- Makefile.cross    1992/10/11 02:44:26
  38. ***************
  39. *** 23,29 ****
  40.   CFLAGS = -O -I. -I$(HOSTINC) -I$(CROSSINC) -DCROSSATARI=1 \
  41.   -DCROSSDIR=\"$(CROSSDIR)\" -DCROSSLIB=\"$(CROSSLIB)\" -DWORD_ALIGNED=1
  42.   
  43. ! ALL = ld sym-ld nm car size size68 tnm xstrip fixstk printstk
  44.   
  45.   all: $(ALL)
  46.   #
  47. --- 23,29 ----
  48.   CFLAGS = -O -I. -I$(HOSTINC) -I$(CROSSINC) -DCROSSATARI=1 \
  49.   -DCROSSDIR=\"$(CROSSDIR)\" -DCROSSLIB=\"$(CROSSLIB)\" -DWORD_ALIGNED=1
  50.   
  51. ! ALL = ld sym-ld nm car size size68 tnm xstrip fixstk printstk toglclr
  52.   
  53.   all: $(ALL)
  54.   #
  55. ***************
  56. *** 74,79 ****
  57. --- 74,85 ----
  58.   xstrip: strip.o
  59.       $(CC) -o xstrip strip.o
  60.   
  61. + #
  62. + # TOS format flags manipulator
  63. + #
  64. + toglclr: toglclr.o
  65. +     $(CC) -o toglclr toglclr.o
  66.   install: $(ALL)
  67.       cp ld $(CROSSLIB)/gcc-ld
  68.       cp nm $(CROSSBIN)/cnm
  69. ***************
  70. *** 84,89 ****
  71. --- 90,96 ----
  72.       cp xstrip $(CROSSBIN)/xstrip
  73.       cp sym-ld $(CROSSBIN)/sym-ld
  74.       cp  fixstk printstk $(CROSSBIN)
  75. +     cp  toglclr $(CROSSBIN)
  76.   
  77.   clean:
  78.       rm -f *.o
  79. *** 1.3    1992/06/03 18:40:27
  80. --- Makefile.hp    1992/10/11 02:44:26
  81. ***************
  82. *** 29,35 ****
  83.   
  84.   LIBS = $(ALLOCA) $(MALLOC1)
  85.   
  86. ! ALL = ld sym-ld nm car size size68 tnm xstrip  fixstk printstk
  87.   
  88.   all: $(ALL)
  89.   #
  90. --- 29,35 ----
  91.   
  92.   LIBS = $(ALLOCA) $(MALLOC1)
  93.   
  94. ! ALL = ld sym-ld nm car size size68 tnm xstrip  fixstk printstk toglclr
  95.   
  96.   all: $(ALL)
  97.   #
  98. ***************
  99. *** 80,85 ****
  100. --- 80,91 ----
  101.   xstrip: strip.o
  102.       $(CC) -o xstrip strip.o $(LIBS)
  103.   
  104. + #
  105. + # TOS format flags manipulator
  106. + #
  107. + toglclr: toglclr.o
  108. +     $(CC) -o toglclr toglclr.o
  109.   install: $(ALL)
  110.       cp ld $(CROSSLIB)/gcc-ld
  111.       cp nm $(CROSSBIN)/cnm
  112. ***************
  113. *** 89,95 ****
  114.       cp tnm $(CROSSBIN)/tnm
  115.       cp xstrip $(CROSSBIN)/xstrip
  116.       cp sym-ld $(CROSSBIN)/sym-ld
  117. !     cp  fixstk printstk $(CROSSBIN)
  118.   
  119.   clean:
  120.       rm -f *.o
  121. --- 95,101 ----
  122.       cp tnm $(CROSSBIN)/tnm
  123.       cp xstrip $(CROSSBIN)/xstrip
  124.       cp sym-ld $(CROSSBIN)/sym-ld
  125. !     cp  fixstk printstk toglclr $(CROSSBIN)
  126.   
  127.   clean:
  128.       rm -f *.o
  129. *** 1.12    1992/06/11 17:45:54
  130. --- Makefile.st    1992/10/11 02:44:26
  131. ***************
  132. *** 18,24 ****
  133.   #ALL = gcc-ld.ttp sym-ld.ttp gcc-nm.ttp gcc-ar.ttp gcc-size.ttp size68.ttp 
  134.   #      cnm.ttp fixstk.ttp printstk.ttp
  135.   ALL = gcc-ld.ttp gcc-nm.ttp gcc-ar.ttp gcc-size.ttp size68.ttp \
  136. !       cnm.ttp fixstk.ttp printstk.ttp xstrip.ttp sym-ld.ttp
  137.   all: $(ALL)
  138.   
  139.   #
  140. --- 18,24 ----
  141.   #ALL = gcc-ld.ttp sym-ld.ttp gcc-nm.ttp gcc-ar.ttp gcc-size.ttp size68.ttp 
  142.   #      cnm.ttp fixstk.ttp printstk.ttp
  143.   ALL = gcc-ld.ttp gcc-nm.ttp gcc-ar.ttp gcc-size.ttp size68.ttp \
  144. !       cnm.ttp fixstk.ttp printstk.ttp xstrip.ttp sym-ld.ttp toglclr.ttp
  145.   all: $(ALL)
  146.   
  147.   #
  148. ***************
  149. *** 81,86 ****
  150. --- 81,92 ----
  151.   #
  152.   xstrip.ttp: strip.c
  153.       $(CC) -O -o xstrip.ttp strip.c -mshort -liio16
  154. + #
  155. + # Manipulate TOS executable header  flags
  156. + #
  157. + toglclr.ttp: toglclr.c
  158. +     $(CC) -O -o toglclr.ttp toglclr.c -mshort -liio16
  159.   
  160.   clean:
  161.       rm -f *.o core
  162. *** 1.1    1991/08/13 21:17:30
  163. --- Makefile.st.hp    1992/10/11 02:44:26
  164. ***************
  165. *** 12,24 ****
  166.   # Cross GCC
  167.   CC=$(CROSSBIN)/cgcc
  168.   
  169. ! CFLAGS = -O -Datarist -I.
  170.   LDFLAGS = -liio
  171.   
  172.   #ALL = gcc-ld.ttp sym-ld.ttp gcc-nm.ttp gcc-ar.ttp gcc-size.ttp size68.ttp 
  173.   #      cnm.ttp fixstk.ttp printstk.ttp
  174.   ALL = gcc-ld.ttp gcc-nm.ttp gcc-ar.ttp gcc-size.ttp size68.ttp \
  175. !       cnm.ttp fixstk.ttp printstk.ttp xstrip.ttp sym-ld.ttp
  176.   all: $(ALL)
  177.   
  178.   #
  179. --- 12,24 ----
  180.   # Cross GCC
  181.   CC=$(CROSSBIN)/cgcc
  182.   
  183. ! CFLAGS = -O2 -fstrength-reduce -fomit-frame-pointer -Datarist -I.
  184.   LDFLAGS = -liio
  185.   
  186.   #ALL = gcc-ld.ttp sym-ld.ttp gcc-nm.ttp gcc-ar.ttp gcc-size.ttp size68.ttp 
  187.   #      cnm.ttp fixstk.ttp printstk.ttp
  188.   ALL = gcc-ld.ttp gcc-nm.ttp gcc-ar.ttp gcc-size.ttp size68.ttp \
  189. !       cnm.ttp fixstk.ttp printstk.ttp xstrip.ttp sym-ld.ttp toglclr.ttp
  190.   all: $(ALL)
  191.   
  192.   #
  193. ***************
  194. *** 81,86 ****
  195. --- 81,92 ----
  196.   #
  197.   xstrip.ttp: strip.c
  198.       $(CC) -O -o xstrip.ttp strip.c -mshort -liio16
  199. + #
  200. + # Manipulate TOS executable header  flags
  201. + #
  202. + toglclr.ttp: toglclr.c
  203. +     $(CC) -O -o toglclr.ttp toglclr.c -mshort -liio16
  204.   
  205.   clean:
  206.       rm -f *.o core
  207. *** 1.29    1992/08/14 17:24:38
  208. --- PatchLev.h    1992/10/11 02:44:27
  209. ***************
  210. *** 1,4 ****
  211. ! #define PatchLevel "31"
  212.   
  213.   /*
  214.    *    the Patch Level above is to identify the version
  215. --- 1,4 ----
  216. ! #define PatchLevel "32"
  217.   
  218.   /*
  219.    *    the Patch Level above is to identify the version
  220. *** 1.7    1992/08/14 17:24:38
  221. --- cnm.c    1992/10/11 02:44:27
  222. ***************
  223. *** 36,41 ****
  224. --- 36,47 ----
  225.   #include <stdio.h>
  226.   #include <st-out.h>
  227.   
  228. + #if __STDC__
  229. + #include <stdlib.h>
  230. + #else
  231. + extern char *malloc(), *realloc();
  232. + #endif
  233.   #ifdef atarist
  234.   # define READB    "rb"
  235.   #else
  236. ***************
  237. *** 42,48 ****
  238.   # define READB "r"
  239.   #endif
  240.   
  241. ! #if !__STDC__
  242.   typedef unsigned long size_t;
  243.   #endif
  244.   
  245. --- 48,54 ----
  246.   # define READB "r"
  247.   #endif
  248.   
  249. ! #if !__STDC__ && !defined(hpux)
  250.   typedef unsigned long size_t;
  251.   #endif
  252.   
  253. ***************
  254. *** 348,350 ****
  255. --- 354,380 ----
  256.       fprintf(stderr, "cnm [-g] files...\n");
  257.       exit(1);
  258.   }
  259. + #if !defined(__GNUC__) &&  defined(hpux)
  260. + char *xmalloc(n)
  261. + int n;    /* sigh! */
  262. + {
  263. +    char *ret = (char *)malloc(n);
  264. +    if(ret) return ret;
  265. +    perror("malloc");
  266. +    exit(1);
  267. + }
  268. + char *xrealloc(b, n)
  269. + char * b;
  270. + int n;    /* sigh! */
  271. + {
  272. +    char *ret = (char *)realloc(b, n);
  273. +    if(ret) return ret;
  274. +    perror("realloc");
  275. +    exit(2);
  276. + }
  277. + #endif
  278. *** 1.36    1992/08/14 17:24:38
  279. --- ld.c    1992/10/11 02:44:29
  280. ***************
  281. *** 396,401 ****
  282. --- 396,406 ----
  283.   #define RELOC_TARGET_BITPOS(r)    0
  284.   #define RELOC_TARGET_BITSIZE(r)    32
  285.   #endif
  286. + #if defined(atarist) || defined(CROSSATARI)
  287. + #define RELOC_ADD_EXTRA(r)    \
  288. +     ((!RELOC_PCREL_P(r) && RELOC_TARGET_SIZE(r) < 2) \
  289. +         ? BASE_OFFSET-text_size : 0)
  290. + #endif
  291.   
  292.   /* Special global symbol types understood by GNU LD.  */
  293.   
  294. ***************
  295. *** 1003,1009 ****
  296.   void copy_text P_((struct file_entry *entry));
  297.   void write_data P_((void));
  298.   void copy_data P_((struct file_entry *entry));
  299. ! void perform_relocation P_((char *data, int pc_relocation, int data_size, struct relocation_info *reloc_info, int reloc_size, struct file_entry *entry));
  300.   void write_rel P_((void));
  301.   void flush_atari_rbuf P_((void));
  302.   int reloc_less_p P_((struct relocation_info *reloc_1, struct relocation_info *reloc_2));
  303. --- 1008,1016 ----
  304.   void copy_text P_((struct file_entry *entry));
  305.   void write_data P_((void));
  306.   void copy_data P_((struct file_entry *entry));
  307. ! void perform_relocation P_((char *data, int pc_relocation, int data_size,
  308. !     struct relocation_info *reloc_info, int reloc_size,
  309. !     struct file_entry *entry, int pure_text));
  310.   void write_rel P_((void));
  311.   void flush_atari_rbuf P_((void));
  312.   int reloc_less_p P_((struct relocation_info *reloc_1, struct relocation_info *reloc_2));
  313. ***************
  314. *** 2715,2725 ****
  315.               if (symdef_base[j].library_member_offset == offset)
  316.                 symdef_base[j].symbol_name_string_index = -1;
  317.                 }
  318.             }
  319. -         /* We'll read the strings again if we need them again.  */
  320. -         free (subentry->strings);
  321. -                 subentry->strings = 0;
  322.             }
  323.         }
  324.       }
  325. --- 2722,2731 ----
  326.               if (symdef_base[j].library_member_offset == offset)
  327.                 symdef_base[j].symbol_name_string_index = -1;
  328.                 }
  329. +             /* We'll read the strings again if we need them again.  */
  330. +             free (subentry->strings);
  331. +             subentry->strings = 0;
  332.             }
  333.             }
  334.         }
  335.       }
  336. ***************
  337. *** 2977,2983 ****
  338.      text segment.  This is right for the type 0x601A Tos header
  339.      and also for the standard Stminix header 
  340.   */ 
  341. !   data_start = text_start + text_size; 
  342.   #else
  343.     if (! Tdata_flag_specified)
  344.       data_start = N_DATADDR (outheader) + text_start - N_TXTADDR (outheader);
  345. --- 2983,2990 ----
  346.      text segment.  This is right for the type 0x601A Tos header
  347.      and also for the standard Stminix header 
  348.   */ 
  349. !   if (! Tdata_flag_specified)
  350. !     data_start = text_start + text_size; 
  351.   #else
  352.     if (! Tdata_flag_specified)
  353.       data_start = N_DATADDR (outheader) + text_start - N_TXTADDR (outheader);
  354. ***************
  355. *** 3954,3959 ****
  356. --- 3961,3968 ----
  357.     /* TOS */
  358.     outheader.a_AZero1 = 0;        /* good a place as any to do this */
  359.     outheader.a_ldflgs = 0;        /* fastload is NOT the default */
  360. +   if (magic == NMAGIC)
  361. +     outheader.a_ldflgs = F_SHTEXT;    /* sharable text */
  362.     outheader.a_isreloc = ISRELOCINFO;    /* means reloc present (!) */
  363.   #endif
  364.   #endif
  365. ***************
  366. *** 4267,4273 ****
  367.     /* Relocate the text according to the text relocation.  */
  368.   
  369.     perform_relocation (bytes, entry->text_start_address, entry->header.a_text,
  370. !               reloc, entry->header.a_trsize, entry);
  371.   
  372.     /* Write the relocated text to the output file.  */
  373.   
  374. --- 4276,4282 ----
  375.     /* Relocate the text according to the text relocation.  */
  376.   
  377.     perform_relocation (bytes, entry->text_start_address, entry->header.a_text,
  378. !               reloc, entry->header.a_trsize, entry, (magic == NMAGIC));
  379.   
  380.     /* Write the relocated text to the output file.  */
  381.   
  382. ***************
  383. *** 4337,4347 ****
  384.       fatal_with_file ("premature eof in data section of ", entry);
  385.   
  386.     perform_relocation (bytes, entry->data_start_address - entry->header.a_text,
  387. !               entry->header.a_data, reloc, entry->header.a_drsize, entry);
  388.   
  389.     mywrite (bytes, 1, entry->header.a_data, outdesc);
  390.   }
  391.   
  392.   /* Relocate ENTRY's text or data section contents.
  393.      DATA is the address of the contents, in core.
  394.      DATA_SIZE is the length of the contents.
  395. --- 4346,4378 ----
  396.       fatal_with_file ("premature eof in data section of ", entry);
  397.   
  398.     perform_relocation (bytes, entry->data_start_address - entry->header.a_text,
  399. !               entry->header.a_data, reloc, entry->header.a_drsize,
  400. !               entry, 0);
  401.   
  402.     mywrite (bytes, 1, entry->header.a_data, outdesc);
  403.   }
  404.   
  405. + static symbol *
  406. + retsym (p, entry)
  407. +      struct relocation_info *p;
  408. +      struct file_entry *entry;
  409. + {
  410. +   register int symindex = RELOC_SYMBOL (p) * sizeof (struct nlist);
  411. +   register symbol *sp = ((symbol *)
  412. +             (((struct nlist *)
  413. +               (((char *)entry->symbols) + symindex))
  414. +              ->n_un.n_name));
  415. +   if (symindex >= entry->header.a_syms)
  416. +     fatal_with_file ("relocation symbolnum out of range in ", entry);
  417. + #ifdef N_INDR
  418. +   /* Resolve indirection */
  419. +   if ((sp->defined & ~N_EXT) == N_INDR)
  420. +     sp = (symbol *) sp->value;
  421. + #endif
  422. +   return sp;
  423. + }
  424.   /* Relocate ENTRY's text or data section contents.
  425.      DATA is the address of the contents, in core.
  426.      DATA_SIZE is the length of the contents.
  427. ***************
  428. *** 4352,4358 ****
  429.   /* This version is about to be severley hacked by Randy.  Hope it
  430.      works afterwards. */
  431.   void
  432. ! perform_relocation (data, pc_relocation, data_size, reloc_info, reloc_size, entry)
  433.        char *data;
  434.        struct relocation_info *reloc_info;
  435.        struct file_entry *entry;
  436. --- 4383,4390 ----
  437.   /* This version is about to be severley hacked by Randy.  Hope it
  438.      works afterwards. */
  439.   void
  440. ! perform_relocation (data, pc_relocation, data_size, reloc_info, reloc_size,
  441. !     entry, pure_text)
  442.        char *data;
  443.        struct relocation_info *reloc_info;
  444.        struct file_entry *entry;
  445. ***************
  446. *** 4359,4364 ****
  447. --- 4391,4397 ----
  448.        int pc_relocation;
  449.        int data_size;
  450.        int reloc_size;
  451. +      int pure_text;
  452.   {
  453.     register struct relocation_info *p = reloc_info;
  454.     struct relocation_info *end
  455. ***************
  456. *** 4373,4378 ****
  457. --- 4406,4412 ----
  458.         register int relocation = 0;
  459.         register int addr;
  460.         register unsigned int mask = 0;
  461. +       symbol *sp;
  462.   
  463.   #ifdef BYTE_SWAP    /* swap relocation info */
  464.   { /* BITFIELD ALERT BITFIELD ALERT */
  465. ***************
  466. *** 4395,4414 ****
  467.   
  468.         if (RELOC_EXTERN_P(p))
  469.       {
  470. !       int symindex = RELOC_SYMBOL (p) * sizeof (struct nlist);
  471. !       symbol *sp = ((symbol *)
  472. !             (((struct nlist *)
  473. !               (((char *)entry->symbols) + symindex))
  474. !              ->n_un.n_name));
  475. ! #ifdef N_INDR
  476. !       /* Resolve indirection */
  477. !       if ((sp->defined & ~N_EXT) == N_INDR)
  478. !         sp = (symbol *) sp->value;
  479. ! #endif
  480. !       if (symindex >= entry->header.a_syms)
  481. !         fatal_with_file ("relocation symbolnum out of range in ", entry);
  482.   
  483.         /* If the symbol is undefined, leave it at zero.  */
  484.         if (! sp->defined)
  485. --- 4429,4435 ----
  486.   
  487.         if (RELOC_EXTERN_P(p))
  488.       {
  489. !       sp = retsym(p, entry);
  490.   
  491.         /* If the symbol is undefined, leave it at zero.  */
  492.         if (! sp->defined)
  493. ***************
  494. *** 4475,4482 ****
  495.         break;
  496.   
  497.       case 1:
  498. !       if (RELOC_MEMORY_ADD_P(p))
  499. !         relocation += mask & *(short *) (data + addr);
  500.         *(short *) (data + addr) &= ~mask;
  501.         *(short *) (data + addr) |= relocation;
  502.         break;
  503. --- 4496,4513 ----
  504.         break;
  505.   
  506.       case 1:
  507. !       if (RELOC_MEMORY_ADD_P(p)) {
  508. !         if (RELOC_PCREL_P(p))
  509. !           relocation += mask & *(short *) (data + addr);
  510. !         else
  511. !           relocation += mask & *(unsigned short *) (data + addr);
  512. !       }
  513. !       if (relocation > 32767 || relocation < -32768) {
  514. !         sp = retsym(p, entry);
  515. !         error ("relocation out of range for %s in %s",
  516. !             sp->name, entry->filename);
  517. !         make_executable = 0;
  518. !       }
  519.         *(short *) (data + addr) &= ~mask;
  520.         *(short *) (data + addr) |= relocation;
  521.         break;
  522. ***************
  523. *** 4498,4503 ****
  524. --- 4529,4540 ----
  525.   
  526.         if (RELOC_MEMORY_ADD_P(p))
  527.           relocation += mask & word;
  528. +       if (pure_text && relocation > text_size+text_start) {
  529. +         sp = retsym(p, entry);
  530. +         error ("absolute reference to %s from pure-text in %s",
  531. +         sp->name, entry->filename);
  532. +         make_executable = 0;    /* set exit code */
  533. +       }
  534.         word &= ~mask;
  535.         word |= relocation;
  536.         data[addr] = word >> 24;
  537. ***************
  538. *** 4671,4677 ****
  539.     qsort(entry->textrel, n_relocs, sizeof (struct relocation_info), 
  540.       reloc_less_p);
  541.     for (reloc_num = n_relocs - 1 ; reloc_num >= 0 ; reloc_num-- )
  542. !     if (!emit_atari_reloc(entry->textrel[reloc_num].r_address + text_base))
  543.           fprintf(stderr, "  while processing text rel %d/%d of entry %s\n",
  544.           reloc_num, n_relocs, entry->filename);
  545.   }
  546. --- 4708,4715 ----
  547.     qsort(entry->textrel, n_relocs, sizeof (struct relocation_info), 
  548.       reloc_less_p);
  549.     for (reloc_num = n_relocs - 1 ; reloc_num >= 0 ; reloc_num-- )
  550. !     if ((entry->textrel[reloc_num].r_length == 2) &&
  551. !       !emit_atari_reloc(entry->textrel[reloc_num].r_address + text_base))
  552.           fprintf(stderr, "  while processing text rel %d/%d of entry %s\n",
  553.           reloc_num, n_relocs, entry->filename);
  554.   }
  555. *** 1.21    1992/07/30 20:53:34
  556. --- sym-ld.c    1992/10/11 02:44:31
  557. ***************
  558. *** 892,898 ****
  559. --- 892,902 ----
  560.   
  561.   int xmalloc ();
  562.   int xrealloc ();
  563. + #if __STDC__
  564. + void fatal (char *string, ...);
  565. + #else
  566.   void fatal ();
  567. + #endif
  568.   void fatal_with_file ();
  569.   void perror_name ();
  570.   void perror_file ();
  571. ***************
  572. *** 2435,2445 ****
  573.               if (symdef_base[j].library_member_offset == offset)
  574.                 symdef_base[j].symbol_name_string_index = -1;
  575.                 }
  576.             }
  577. -         /* We'll read the strings again if we need them again.  */
  578. -         free (subentry->strings);
  579. -                 subentry->strings = 0;
  580.             }
  581.         }
  582.       }
  583. --- 2439,2448 ----
  584.               if (symdef_base[j].library_member_offset == offset)
  585.                 symdef_base[j].symbol_name_string_index = -1;
  586.                 }
  587. +             /* We'll read the strings again if we need them again.  */
  588. +             free (subentry->strings);
  589. +             subentry->strings = 0;
  590.             }
  591.             }
  592.         }
  593.       }
  594. ***************
  595. *** 4913,4919 ****
  596.   
  597.   int
  598.   parse (arg, format, error)
  599. !      char *arg, *format;
  600.   {
  601.     int x;
  602.     if (1 != sscanf (arg, format, &x))
  603. --- 4916,4922 ----
  604.   
  605.   int
  606.   parse (arg, format, error)
  607. !      char *arg, *format, *error;
  608.   {
  609.     int x;
  610.     if (1 != sscanf (arg, format, &x))
  611. *** 1.2    1992/07/21 14:52:06
  612. --- toglclr.c    1992/10/11 02:44:31
  613. ***************
  614. *** 1,9 ****
  615. ! /*
  616. !  * utility to toggle clear TPA beyond BSS flag in .prg header for Tos 1.4
  617.    *
  618. !  *    Usage: toglclr file file ....
  619.    *
  620. !  *    ++jrb
  621.    */
  622.   
  623.   #include <stdio.h>
  624. --- 1,26 ----
  625. ! /*                             -*- Mode: Elec-C -*- 
  626. !  * toglclr.c -- utility to toggle the program load flags in the .prg header.
  627.    *
  628. !  *              usage: toglclr [options] file file ...
  629. !  * 
  630. !  * Author          : J.R. Bammi, modified by F. Ridderbusch
  631. !  * Created On      : Some time ago.
  632. !  * Last Modified By: J.R. Bammi
  633. !  * Last Modified On: Fri Sep 25 12:00:28 1992
  634. !  * Update Count    : 6
  635. !  * Status          : Unknown, Use with caution!
  636. !  */
  637. ! /* HISTORY 
  638. !  * 25-Sep-1992          ++jrb
  639. !  *    Added support for cross-environment with support for 
  640. !  *    WORD_ALIGNED hosts.
  641.    *
  642. !  * 13-Sep-1992        Frank Ridderbusch    
  643. !  *    This program was originally written by J.R. Bammi
  644. !  *    (bammi@cadence.com) to toggle the clear TPA above BSS flag
  645. !  *    introduced with TOS 1.4. I extended it to also handle the additional
  646. !  *    program flags introduced with the TOS versions for the STE and TT.
  647.    */
  648.   
  649.   #include <stdio.h>
  650. ***************
  651. *** 13,21 ****
  652.   #include <st-out.h>
  653.   
  654.   #ifndef FILENAME_MAX
  655. ! #  define FILENAME_MAX 128
  656.   #endif
  657.   
  658.   int toggle (fd, fn)
  659.   int fd;
  660.   char *fn;
  661. --- 30,111 ----
  662.   #include <st-out.h>
  663.   
  664.   #ifndef FILENAME_MAX
  665. ! #define FILENAME_MAX 1024
  666.   #endif
  667.   
  668. + int flags_to_toggle = 0;
  669. + #ifdef WORD_ALIGNED
  670. + #define ckread(addr, bytes, fd) if(read(fd, addr, bytes) != bytes) return 1;
  671. + #define ckwrite(addr, bytes, fd) if(write(fd, addr, bytes) != bytes) return 1;
  672. + int readhead(h, fd)
  673. + struct aexec *h;
  674. + int fd;
  675. + {
  676. +     short i;
  677. +     long j;
  678. +     int k;
  679. +     
  680. +     ckread(&i, 2, fd);
  681. +     h->a_magic = i;
  682. +     ckread(&j, 4, fd);
  683. +     h->a_text = j;
  684. +     ckread(&j, 4, fd);
  685. +     h->a_data = j;
  686. +     ckread(&j, 4, fd);
  687. +     h->a_bss = j;
  688. +     ckread(&j, 4, fd);
  689. +     h->a_syms = j;
  690. +     ckread(&j, 4, fd);
  691. +     h->a_AZero1 = j;
  692. +     ckread(&j, 4, fd);
  693. +     h->a_ldflgs = j;
  694. +     ckread(&i, 2, fd);
  695. +     h->a_isreloc = i;
  696. +     return 0;
  697. + }
  698. + int writehead(h, fd)
  699. + struct aexec *h;
  700. + int fd;
  701. + {
  702. +     short i;
  703. +     long j;
  704. +     int k;
  705. +     
  706. +     i = h->a_magic;
  707. +     ckwrite(&i, 2, fd);
  708. +     j = h->a_text;
  709. +     ckwrite(&j, 4, fd);
  710. +     j = h->a_data;
  711. +     ckwrite(&j, 4, fd);
  712. +     j = h->a_bss;
  713. +     ckwrite(&j, 4, fd);
  714. +     j = h->a_syms;
  715. +     ckwrite(&j, 4, fd);
  716. +     j = h->a_AZero1;
  717. +     ckwrite(&j, 4, fd);
  718. +     j = h->a_ldflgs;
  719. +     ckwrite(&j, 4, fd);
  720. +     i = h->a_isreloc;
  721. +     ckwrite(&i, 2, fd);
  722. +     return 0;
  723. + }
  724. + #else
  725. + #define readhead(addr, fd) \
  726. +  (read(fd, addr, sizeof(struct aexec)) != sizeof(struct aexec))
  727. + #define writehead(addr, fd) \
  728. +  (write(fd, addr, sizeof(struct aexec)) != sizeof(struct aexec))
  729. + #endif /* WORD_ALIGNED */
  730.   int toggle (fd, fn)
  731.   int fd;
  732.   char *fn;
  733. ***************
  734. *** 22,29 ****
  735.   {
  736.       struct aexec head;
  737.       unsigned long t;
  738.       
  739. !     if(read(fd, &head, sizeof(head)) != sizeof(head))
  740.       {
  741.       perror(fn);
  742.       return 4;
  743. --- 112,120 ----
  744.   {
  745.       struct aexec head;
  746.       unsigned long t;
  747. +     char *ptr;
  748.       
  749. !     if(readhead(&head, fd))
  750.       {
  751.       perror(fn);
  752.       return 4;
  753. ***************
  754. *** 35,49 ****
  755.       }
  756.   
  757.       t = head.a_AZero2;
  758. !     head.a_AZero2 ^= 1;
  759. !     lseek(fd, 0L, SEEK_SET);
  760. !     if(write(fd, &head, sizeof(head)) != sizeof(head))
  761.       {
  762. !     perror(fn);
  763. !     return 16;
  764.       }
  765.   
  766. !     printf("%s: was %d is %d\n", fn, (int)t, (int)head.a_AZero2);
  767.       return 0;
  768.   }
  769.   
  770. --- 126,154 ----
  771.       }
  772.   
  773.       t = head.a_AZero2;
  774. !     if (flags_to_toggle)
  775.       {
  776. !         head.a_AZero2 ^= flags_to_toggle;
  777. !         lseek(fd, 0L, SEEK_SET);
  778. !     if(writehead(&head, fd))
  779. !         {
  780. !         perror(fn);
  781. !         return 16;
  782. !         }
  783.       }
  784.   
  785. !     printf("%s:            `fast load' bit was %d is now %d\n", fn, 
  786. !        (int)((t & F_FASTLOAD) == F_FASTLOAD),
  787. !        (int)((head.a_AZero2 & F_FASTLOAD) == F_FASTLOAD));
  788. !     printf("%s:      `run in fast ram' bit was %d is now %d\n", fn, 
  789. !        (int)((t & F_ALTLOAD) == F_ALTLOAD),
  790. !        (int)((head.a_AZero2 & F_ALTLOAD) == F_ALTLOAD));
  791. !     printf("%s: `malloc from fast ram' bit was %d is now %d\n", fn, 
  792. !        (int)((t & F_ALTALLOC) == F_ALTALLOC),
  793. !        (int)((head.a_AZero2 & F_ALTALLOC) == F_ALTALLOC));
  794.       return 0;
  795.   }
  796.   
  797. ***************
  798. *** 57,69 ****
  799.       
  800.       if(argc < 2)
  801.       {
  802. !     fprintf(stderr, "usage: toglclr file file .....\n");
  803.       exit(1);
  804.       }
  805.   
  806.       while(--argc > 0)
  807.       {
  808. !     (void) strcpy(fn, *++argv);
  809.           if((fd = open(fn, 2)) < 0)
  810.           {
  811.           perror(fn);
  812. --- 162,189 ----
  813.       
  814.       if(argc < 2)
  815.       {
  816. !     fprintf(stderr, "usage: toglclr [options] file file .....\n\n");
  817. !     fprintf(stderr, "options: -fload = toggle `fast load' bit\n");
  818. !     fprintf(stderr, "         -frun  = toggle `load program into fast ram' bit\n");
  819. !     fprintf(stderr, "         -fram  = toggle `malloc from fast ram' bit\n\n");
  820. !     fprintf(stderr, "without options the current state is reported.\n");
  821.       exit(1);
  822.       }
  823.   
  824. +     while (**++argv == '-')
  825. +     {
  826. +         if (!strcmp(*argv, "-fload"))
  827. +         flags_to_toggle |= F_FASTLOAD;
  828. +         if (!strcmp(*argv, "-frun"))
  829. +         flags_to_toggle |= F_ALTLOAD;
  830. +         if (!strcmp(*argv, "-fram"))
  831. +         flags_to_toggle |= F_ALTALLOC;
  832. +     --argc;
  833. +     }
  834.       while(--argc > 0)
  835.       {
  836. !     (void) strcpy(fn, *argv++);
  837.           if((fd = open(fn, 2)) < 0)
  838.           {
  839.           perror(fn);
  840. ***************
  841. *** 79,82 ****
  842.       
  843.       return status;
  844.   }
  845. --- 199,201 ----
  846.